<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Carbon - Admin Template</title>
    <link rel="stylesheet" href="/static/dist/vendor/simple-line-icons/css/simple-line-icons.css">
    <link rel="stylesheet" href="/static/dist/vendor/font-awesome/css/fontawesome-all.min.css">
    <link rel="stylesheet" href="/static/dist/css/styles.css">
    <link rel="stylesheet" href="/static/dist/css/footer.css">
    <style>


    </style>
</head>
<body class="sidebar-fixed header-fixed">
    {% block formTitle %}
    {% endblock %}
<div class="page-wrapper">
    <nav class="navbar page-header">
        <a href="#" class="btn btn-link sidebar-mobile-toggle d-md-none mr-auto">
            <i class="fa fa-bars"></i>
        </a>

        <a class="navbar-brand" href="#">
            <img src="/static/dist/imgs/logo.png" alt="logo">
        </a>

        <a href="#" class="btn btn-link sidebar-toggle d-md-down-none">
            <i class="fa fa-bars"></i>
        </a>

        <ul class="navbar-nav ml-auto">
            <li class="nav-item d-md-down-none">
                <a href="#">
                    <i class="fa fa-bell"></i>
                    <span class="badge badge-pill badge-danger">5</span>
                </a>
            </li>

            <li class="nav-item d-md-down-none">
                <a href="#">
                    <i class="fa fa-envelope-open"></i>
                    <span class="badge badge-pill badge-danger">5</span>
                </a>
            </li>

            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <img src="/static/dist/imgs/avatar-1.png" class="avatar avatar-sm" alt="logo">
                    <span class="small ml-1 d-md-down-none">{{login_user}}</span>
                </a>

                <div class="dropdown-menu dropdown-menu-right">
                    <div class="dropdown-header">Account</div>

                    <a href="#" class="dropdown-item">
                        <i class="fa fa-user"></i> Profile
                    </a>

                    <a href="#" class="dropdown-item">
                        <i class="fa fa-envelope"></i> Messages
                    </a>

                    <div class="dropdown-header">Settings</div>

                    <a href="#" class="dropdown-item">
                        <i class="fa fa-bell"></i> Notifications
                    </a>

                    <a href="/cmdb/index/page/set/" class="dropdown-item">
                        <i class="fa fa-wrench"></i> Settings
                    </a>

                    <a href="/cmdb/logout/" class="dropdown-item">
                        <i class="fa fa-lock"></i> Logout
                    </a>
                </div>
            </li>
        </ul>
    </nav>


    <div class="main-container">
        <div class="sidebar">
            <nav class="sidebar-nav">
                <ul class="nav">
                    <li class="nav-title">Navigation</li>

                    <li class="nav-item">
                        <a href="/cmdb/index/" class="nav-link active">
                            <i class="icon icon-speedometer"></i> 仪表盘
                        </a>
                    </li>

                    <li class="nav-item nav-dropdown" id="layout">
                        <a href="#" class="nav-link nav-dropdown-toggle">
                            <i class="icon icon-target"></i> Layouts <i class="fa fa-caret-left"></i>
                        </a>

                        <ul class="nav-dropdown-items">
                            <li class="nav-item">
                                <a href="/cmdb/index/layout/normal/" class="nav-link">
                                    <i class="icon icon-target"></i> Normal
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/layout/fixed-sidebar/" class="nav-link">
                                    <i class="icon icon-target"></i> Fixed Sidebar
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/layout/fixed-header/" class="nav-link">
                                    <i class="icon icon-target"></i> Fixed Header
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/layout/hide-sidebar/" class="nav-link">
                                    <i class="icon icon-target"></i> Hidden Sidebar
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="nav-item nav-dropdown" id="ui">
                        <a href="#" class="nav-link nav-dropdown-toggle">
                            <i class="icon icon-energy"></i> UI Kits <i class="fa fa-caret-left"></i>
                        </a>

                        <ul class="nav-dropdown-items">
                            <li class="nav-item">
                                <a href="/cmdb/index/ui/alert/" class="nav-link">
                                    <i class="icon icon-energy"></i> Alerts
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/button/" class="nav-link">
                                    <i class="icon icon-energy"></i> Buttons
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/card/" class="nav-link">
                                    <i class="icon icon-energy"></i> Cards
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/modal/" class="nav-link">
                                    <i class="icon icon-energy"></i> Modals
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/tab/" class="nav-link">
                                    <i class="icon icon-energy"></i> Tabs
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/progress-bar/" class="nav-link">
                                    <i class="icon icon-energy"></i> Progress Bars
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/ui/widget/" class="nav-link">
                                    <i class="icon icon-energy"></i> Widgets
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="nav-item nav-dropdown" id="chart">
                        <a href="#" class="nav-link nav-dropdown-toggle">
                            <i class="icon icon-graph"></i> Charts <i class="fa fa-caret-left"></i>
                        </a>

                        <ul class="nav-dropdown-items">
                            <li class="nav-item">
                                <a href="/cmdb/index/chart/js/" class="nav-link">
                                    <i class="icon icon-graph"></i> Chart.js
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="nav-item">
                        <a href="/cmdb/index/form/" class="nav-link">
                            <i class="icon icon-puzzle"></i> Forms
                        </a>
                    </li>

                    <li class="nav-item  nav-dropdown" id="workflow">
                        <a href="#" class="nav-link nav-dropdown-toggle">
                            <i class="icon icon-grid"></i> 用户管理 <i class="fa fa-caret-left"></i>
                        </a>

                        <ul class="nav-dropdown-items">
                            <li class="nav-item">
                                <a href="/cmdb/index/table/user/" class="nav-link">
                                    <i class="icon icon-grid"></i> 用户列表
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/monitor/zabbix/" class="nav-link">
                                    <i class="icon icon-grid"></i> zabbix监控
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/monitor/prometheus/" class="nav-link">
                                    <i class="icon icon-grid"></i> prometheus监控
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/monitor/prometheus/" class="nav-link">
                                    <i class="icon icon-grid"></i> ansible批量操作
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/wf/" class="nav-link">
                                    <i class="icon icon-grid"></i> 工单流程
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/wf/tasks/" class="nav-link">
                                    <i class="icon icon-grid"></i> 我的待办
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="/cmdb/index/wf/requests/" class="nav-link">
                                    <i class="icon icon-grid"></i> 我的请求
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li class="nav-title">More</li>

                    <li class="nav-item nav-dropdown" id="other">
                        <a href="#" class="nav-link nav-dropdown-toggle">
                            <i class="icon icon-umbrella"></i> Pages <i class="fa fa-caret-left"></i>
                        </a>

                        <ul class="nav-dropdown-items">
                            <li class="nav-item">
                                <a href="/cmdb/index/page/blank/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> Blank Page
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/login/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> Login
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/register/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> Register
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/invoice/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> Invoice
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/404/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> 404
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/500/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> 500
                                </a>
                            </li>

                            <li class="nav-item">
                                <a href="/cmdb/index/page/set/" class="nav-link">
                                    <i class="icon icon-umbrella"></i> Settings
                                </a>
                            </li>
                        </ul>

                    </li>

                </ul>
            </nav>
        </div>
        {% block content %}


        {% endblock %}

    </div>
    <nav class="footer">
        copyright@chenhu 2019-2020 All Rights Reserverd
    </nav>

</div>

    {% block formFooter %}

    {% endblock %}

<script src="/static/dist/vendor/jquery/jquery.min.js"></script>
<script src="/static/dist/vendor/popper.js/popper.min.js"></script>
<script src="/static/dist/vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/dist/vendor/chart.js/chart.min.js"></script>
<script src="/static/dist/js/carbon.js"></script>
<script src="/static/dist/js/demo.js"></script>
<script src="/static/jquery.cookie.js"></script>
<script>

$(function(){
//绑定a链接的点击事件
//点击a链接的时候将id写进cookie
var arrSubNav = document.getElementsByClassName('nav-item nav-dropdown');
for (var i = 0; i < arrSubNav.length; i++) {
    //var arrHref = arrSubNav[i].getElementsByClassName('nav-link');
    var arrUl = arrSubNav[i].getElementsByClassName('nav-dropdown-items');
    //console.log(arrUl)
    for(k=0;k<arrUl.length;k++){
        var arrHref = arrUl[k].getElementsByClassName('nav-link');
        //console.log(arrHref)
        for (var j = 0; j < arrHref.length; j++) {
            arrHref[j].onclick = function () {
                var nodeParent = this.parentNode.parentNode.parentNode; //获取a链接所在的那个div块儿的id,注意,此处用this
                console.log(nodeParent)
                var idParent = nodeParent.getAttribute('id');
                //document.cookie="userCheck="+idParent+";domain=127.0.0.1;path=/"; //用cookie记录下用户当前的选择
                $.cookie('userCheck',idParent,{path:'/'});
            };
        }
        //console.log(arrUl)
    }
     menuSelected = $.cookie('userCheck');
     if(menuSelected){
        document.getElementById(menuSelected).setAttribute("class","nav-item nav-dropdown open");
     };
};
})

</script>
{% block javascript %}

{% endblock %}

</body>

</html>
